jQuery(document).ready(function() {
    var searchedString = getUrlVars()['filter_number'];
    var manufacturer = getUrlVars()['manufacturer'];
	var languageName = getUrlVars()['languageName'];
    httpObject = getHTTPObject();
    if (httpObject != null) {
        var url = "../../../Ajax/SearchedOnMain.aspx?manufacturer=" + manufacturer + "&filter_number=" + searchedString + "&languageName=" + languageName;
        httpObject.open("GET", url, true);
        httpObject.onreadystatechange = function() {
            if (httpObject.readyState == 4) {
                jQuery("#contentHolderInner").html(httpObject.responseText);
                jQuery("#searchedFilter").html(searchedString);
				
				var filterNumber = jQuery("#searchRightSideTopLeft > h3 span").html();
				var filterImg = new Image();
				filterImg.src = "../../Content/images/filters/Filtron/" + filterNumber + ".jpg";
				filterImg.onerror = function() {
					jQuery("#searchRightSideTopRightFiltron > img").attr('src', '../../Content/images/temp/example_filter.png');
				}
				
            } //if state
        } //func
        httpObject.send(null);
    } //if
});

function getUrlVars() {
	var vars = {};
	var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
		vars[key] = value;
	});
	return vars;
}